<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>


<div id="red">红盒子</div>
<div id="blue">蓝盒子</div>
<script>
var red = document.getElementById("red");	// 获取红色盒子
alert(red.getAttribute("id"));				// 显示红色盒子的id属性值
var blue = document.getElementById("blue");// 获取蓝色盒子
alert(blue.getAttribute("id"));				// 显示蓝色盒子的id属性值

</script>




</body>
</html>
